home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xpcom / nsIStringStream.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  7KB  |  179 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIStringStream.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIStringStream_h__
  6. #define __gen_nsIStringStream_h__
  7.  
  8.  
  9. #ifndef __gen_nsIInputStream_h__
  10. #include "nsIInputStream.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17.  
  18. /* starting interface:    nsIStringInputStream */
  19. #define NS_ISTRINGINPUTSTREAM_IID_STR "450cd2d4-f0fd-424d-b365-b1251f80fd53"
  20.  
  21. #define NS_ISTRINGINPUTSTREAM_IID \
  22.   {0x450cd2d4, 0xf0fd, 0x424d, \
  23.     { 0xb3, 0x65, 0xb1, 0x25, 0x1f, 0x80, 0xfd, 0x53 }}
  24.  
  25. /**
  26.  * nsIStringInputStream
  27.  *
  28.  * Provides scriptable and specialized C++ only methods for initializing a
  29.  * nsIInputStream implementation with a simple character array.
  30.  */
  31. class NS_NO_VTABLE nsIStringInputStream : public nsIInputStream {
  32.  public: 
  33.  
  34.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTRINGINPUTSTREAM_IID)
  35.  
  36.   /**
  37.      * SetData - assign data to the input stream (copied on assignment).
  38.      *
  39.      * @param data    - stream data
  40.      * @param dataLen - stream data length (-1 if length should be computed)
  41.      *
  42.      * NOTE: C++ code should consider using AdoptData or ShareData to avoid
  43.      * making an extra copy of the stream data.
  44.      */
  45.   /* void setData (in string data, in long dataLen); */
  46.   NS_IMETHOD SetData(const char *data, PRInt32 dataLen) = 0;
  47.  
  48.   /**
  49.      * NOTE: the following methods are designed to give C++ code added control
  50.      * over the ownership and lifetime of the stream data.  Use with care :-)
  51.      */
  52. /**
  53.      * AdoptData - assign data to the input stream.  the input stream takes
  54.      * ownership of the given data buffer and will nsMemory::Free it when
  55.      * the input stream is destroyed.
  56.      *
  57.      * @param data      - stream data
  58.      * @param dataLen   - stream data length (-1 if length should be computed)
  59.      */
  60.   /* [noscript] void adoptData (in charPtr data, in long dataLen); */
  61.   NS_IMETHOD AdoptData(char * data, PRInt32 dataLen) = 0;
  62.  
  63.   /**
  64.      * ShareData - assign data to the input stream.  the input stream references
  65.      * the given data buffer until the input stream is destroyed.  the given
  66.      * data buffer must outlive the input stream.
  67.      *
  68.      * @param data      - stream data
  69.      * @param dataLen   - stream data length (-1 if length should be computed)
  70.      */
  71.   /* [noscript] void shareData (in string data, in long dataLen); */
  72.   NS_IMETHOD ShareData(const char *data, PRInt32 dataLen) = 0;
  73.  
  74. };
  75.  
  76. /* Use this macro when declaring classes that implement this interface. */
  77. #define NS_DECL_NSISTRINGINPUTSTREAM \
  78.   NS_IMETHOD SetData(const char *data, PRInt32 dataLen); \
  79.   NS_IMETHOD AdoptData(char * data, PRInt32 dataLen); \
  80.   NS_IMETHOD ShareData(const char *data, PRInt32 dataLen); 
  81.  
  82. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  83. #define NS_FORWARD_NSISTRINGINPUTSTREAM(_to) \
  84.   NS_IMETHOD SetData(const char *data, PRInt32 dataLen) { return _to SetData(data, dataLen); } \
  85.   NS_IMETHOD AdoptData(char * data, PRInt32 dataLen) { return _to AdoptData(data, dataLen); } \
  86.   NS_IMETHOD ShareData(const char *data, PRInt32 dataLen) { return _to ShareData(data, dataLen); } 
  87.  
  88. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  89. #define NS_FORWARD_SAFE_NSISTRINGINPUTSTREAM(_to) \
  90.   NS_IMETHOD SetData(const char *data, PRInt32 dataLen) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetData(data, dataLen); } \
  91.   NS_IMETHOD AdoptData(char * data, PRInt32 dataLen) { return !_to ? NS_ERROR_NULL_POINTER : _to->AdoptData(data, dataLen); } \
  92.   NS_IMETHOD ShareData(const char *data, PRInt32 dataLen) { return !_to ? NS_ERROR_NULL_POINTER : _to->ShareData(data, dataLen); } 
  93.  
  94. #if 0
  95. /* Use the code below as a template for the implementation class for this interface. */
  96.  
  97. /* Header file */
  98. class nsStringInputStream : public nsIStringInputStream
  99. {
  100. public:
  101.   NS_DECL_ISUPPORTS
  102.   NS_DECL_NSISTRINGINPUTSTREAM
  103.  
  104.   nsStringInputStream();
  105.  
  106. private:
  107.   ~nsStringInputStream();
  108.  
  109. protected:
  110.   /* additional members */
  111. };
  112.  
  113. /* Implementation file */
  114. NS_IMPL_ISUPPORTS1(nsStringInputStream, nsIStringInputStream)
  115.  
  116. nsStringInputStream::nsStringInputStream()
  117. {
  118.   /* member initializers and constructor code */
  119. }
  120.  
  121. nsStringInputStream::~nsStringInputStream()
  122. {
  123.   /* destructor code */
  124. }
  125.  
  126. /* void setData (in string data, in long dataLen); */
  127. NS_IMETHODIMP nsStringInputStream::SetData(const char *data, PRInt32 dataLen)
  128. {
  129.     return NS_ERROR_NOT_IMPLEMENTED;
  130. }
  131.  
  132. /* [noscript] void adoptData (in charPtr data, in long dataLen); */
  133. NS_IMETHODIMP nsStringInputStream::AdoptData(char * data, PRInt32 dataLen)
  134. {
  135.     return NS_ERROR_NOT_IMPLEMENTED;
  136. }
  137.  
  138. /* [noscript] void shareData (in string data, in long dataLen); */
  139. NS_IMETHODIMP nsStringInputStream::ShareData(const char *data, PRInt32 dataLen)
  140. {
  141.     return NS_ERROR_NOT_IMPLEMENTED;
  142. }
  143.  
  144. /* End of implementation class template. */
  145. #endif
  146.  
  147. //-----------------------------------------------------------------------------
  148. // C++ factory methods
  149. //-----------------------------------------------------------------------------
  150. #include "nsIInputStream.h"
  151. #include "nsString.h"
  152. //-----------------------------------------------------------------------------
  153. // Factory method to get an nsInputStream from an nsAString.  Result will
  154. // implement nsIStringInputStream and nsISeekableStream
  155. extern "C" NS_COM nsresult
  156. NS_NewStringInputStream(nsIInputStream** aStreamResult,
  157.                         const nsAString& aStringToRead);
  158. //-----------------------------------------------------------------------------
  159. // Factory method to get an nsInputStream from an nsACString.  Result will
  160. // implement nsIStringInputStream and nsISeekableStream 
  161. extern "C" NS_COM nsresult
  162. NS_NewCStringInputStream(nsIInputStream** aStreamResult,
  163.                          const nsACString& aStringToRead);
  164. //-----------------------------------------------------------------------------
  165. // Factory method to get an nsInputStream from a string.  Result will
  166. // implement nsIStringInputStream and nsISeekableStream
  167. extern "C" NS_COM nsresult
  168. NS_NewCharInputStream(nsIInputStream** aStreamResult,
  169.                       const char* aStringToRead);
  170. //-----------------------------------------------------------------------------
  171. // Factory method to get an nsInputStream from a byte buffer.  Result will
  172. // implement nsIStringInputStream and nsISeekableStream
  173. extern "C" NS_COM nsresult
  174. NS_NewByteInputStream(nsIInputStream** aStreamResult,
  175.                       const char* aStringToRead,
  176.                       PRInt32 aLength);
  177.  
  178. #endif /* __gen_nsIStringStream_h__ */
  179.